<!--首页页面-->
<style lang="less">
.tousu1 {
  .smallForm {
    width: 100%;
    display: inline-block;
  }
  .image {
    width: 100%;
    height: 750px;
  }
  .modal-pump {
    .ivu-modal-body {
      float: left;
    }
  }
  #map {
    width: 100%;
    height: 400px;
  }
  .ivu-badge-count {
    top: 0 !important;
    right: 5px !important;
  }
  .ivu-card-head p {
    height: 34px;
    line-height: 34px;
  }
}
.demo-upload-list {
  display: inline-block;
  width: 60px;
  height: 60px;
  text-align: center;
  line-height: 60px;
  border: 1px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
  position: relative;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
  margin-right: 4px;
}
.demo-upload-list img {
  width: 100%;
  height: 100%;
}
.demo-upload-list-cover {
  display: none;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.6);
}
.demo-upload-list:hover .demo-upload-list-cover {
  display: block;
}
.demo-upload-list-cover i {
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  margin: 0 2px;
}
.reprotImg {
  width: 50px;
  height: 50px;
  float: left;
  margin-right: 5px;
}
.ivu-modal-body {
  .ivu-tabs {
    overflow-y: overlay;
    overflow-x: hidden;
  }
}
.bg-red {
  color: red;
}
.bg-orange {
  color: orange;
}
</style>

<template>
	<i-col span="24" class="tousu1" style="margin-bottom: 15px">
        <Card :bordered="false">
            <p slot="title" class="white">河流事件
                <Button type="error" class='pull-right' @click="logout">注销</Button>
            </p>
            <div style="position:relative;">
                <Form :model="searchItem" class="smallForm">
                    <Input v-model="searchItem.river_name" style="width:19%;margin-right: 15px;" :maxlength="30" placeholder="请输入河流名称"></Input>
                    <Input v-model="searchItem.chref_name" style="width:19%;margin-right: 15px;" :maxlength="30" placeholder="请输入河长名称"></Input>
                    <Input v-model="searchItem.report_no" style="width:19%;margin-right: 15px;" :maxlength="30" placeholder="请输入事件编号"></Input>
                    <Input v-model="searchItem.overday" style="width:20%;margin-right: 15px;" :maxlength="30" placeholder="请输入超时天数"></Input>
                    <DatePicker @on-change="change" format="yyyy-MM-dd" type="daterange" placeholder="请选择事件日期" style="width: 19%;margin:15px 15px 0 0;"></DatePicker>
                    <dep-select @getData="getDepData" style="width:19%;margin-right: 15px;"></dep-select>
                    <Checkbox v-model="searchItem.can_use">只显示可操作</Checkbox >
                    <Checkbox v-model="searchItem.is_multiple">是否为多次事件河流</Checkbox >
                </Form>
                <Button type="info" style="position:absolute;top:0;right:10%" @click="getComplaint('1',type_solve_is)">搜索</Button>
            </div>
        </Card>
        <Tabs v-model="topTabs" @on-click="aa">
            <TabPane label="处理中" name="处理中">
                <Table ref="table" :data="solveData" :row-class-name="rowClassName" :columns="complaintColumns" stripe></Table>
            </TabPane>
            <TabPane label="已处理" name="已处理">
                <Table ref="table" :data="completeData" :columns="complaintColumns" stripe></Table>
            </TabPane>
        </Tabs>
        <Page
            class="pull-right"
            :total="Page.total"
            :current="Page.current"
            :page-size="Page.pageSize"
            size="small"
            show-total
            @on-change="changePage"
        ></Page>
        <Modal v-model="modal1" width="1000" style="text-align:center">
            <Icon type="chevron-left" style="font-size: 50px;position:absolute;top: 35%;left:5%;" @click.native="changeImge('left')"></Icon>
            <img :src="imgSrc" alt="" style="max-width: 100%;max-height: 750px;">
            <Icon type="chevron-right" style="font-size: 50px;position:absolute;top: 35%;right:5%;" @click.native="changeImge('right')"></Icon>
        </Modal>
        <Modal v-model="comfirmModal" title="处理事件" @on-ok="send" width="600">
            <Form :model="formItem1" :label-width="60">
                <Form-item label="处理结果" v-if="solve" prop="solve_result2">
                    <Input v-model="solve_result2" type="textarea" :maxlength="800" placeholder="处理结果"></Input>
                </Form-item>
                <Form-item label="上传图片" v-if="solve">
                    <div class="demo-upload-list" v-for="item in uploadList">
                        <template v-if="item.status === 'finished'">
                            <img :src="item.url">
                            <div class="demo-upload-list-cover">
                                <Icon type="ios-trash-outline" @click.native="handleRemove(item)"></Icon>
                            </div>
                        </template>
                        <template v-else>
                            <Progress v-if="item.showProgress" :percent="item.percentage" hide-info></Progress>
                        </template>
                    </div>
                    <Upload
                            ref="upload"
                            :show-upload-list="false"
                            :on-success="handleSuccess"
                            :format="['jpg','jpeg','png']"
                            :max-size="2048000"
                            :on-format-error="handleFormatError"
                            :on-exceeded-size="handleMaxSize"
                            :before-upload="handleBeforeUpload"
                            multiple
                            type="drag"
                            :action="uploadUrl"
                            style="display: inline-block;width:58px;">
                            <div style="width: 58px;height:58px;line-height: 58px;">
                                <Icon type="camera" size="20"></Icon>
                            </div>
                    </Upload>
                </Form-item>
            </Form>
        </Modal>
        <Modal v-model="mapModal" width="800">
            <p slot="header" style="color:#f60;text-align:center;float: left">
                查看地理位置
                <div>
                    <img src="../../../static/img/gis1.png" height="30" width="30" alt="">
                    <span>上报人定位</span>
                    <img src="../../../static/img/weizhi.png" height="30" width="30" alt="">
                    <span>上报人上报事件定位</span>
                </div>
            </p>
            <div id="map">

            </div>
        </Modal>
        <Modal v-model="printModal" class="modal-pump" width="800" title="市河长办受理咨询投诉登记表">
            <Form :model="formItem" :label-width="90">
                <i-col span="12">
                    <Form-item label="经办人" prop="confirm_person">
                        <Input v-model="confirm_person" :maxlength="12" value="河长办"></Input>
                    </Form-item>
                    <Form-item label="投诉人" prop="contacts">
                        <Input v-model="contacts" :maxlength="5" placeholder="请输入投诉人"></Input>
                    </Form-item>
                    <Form-item label="联系方式" prop="phone">
                        <Input v-model="phone" :maxlength="11 " placeholder="请输入联系方式"></Input>
                    </Form-item>
                    <Form-item label="河湖名称（河段）" prop="river_name">
                        <Input v-model="river_name" :maxlength="12" placeholder="请输入河湖名称（河段）"></Input>
                    </Form-item>
                </i-col>
                <i-col span="12">
                    <Form-item label="登记编号" prop="report_no">
                        <Input v-model="report_no" :maxlength="20"></Input>
                    </Form-item>
                    <Form-item label="投诉时间" prop="report_time">
                        <Input v-model="report_time" :maxlength="20" placeholder="请输入投诉时间"></Input>
                    </Form-item>
                    <Form-item label="身份证" prop="contacts_id">
                        <Input v-model="contacts_id" :maxlength="20" placeholder="请输入身份证"></Input>
                    </Form-item>
                    <Form-item label="地点" prop="address">
                        <Input v-model="address" :maxlength="18" placeholder="地址"></Input>
                    </Form-item>
                </i-col>
                <i-col span="24">
                    <Form-item label="上级督办意见" prop="advice">
                        <Input type="textarea" readonly v-model="advice" :maxlength="800" placeholder="上级督办意见"></Input>
                    </Form-item>
                    <Form-item label="事件描述" prop="overview">
                        <Input type="textarea" v-model="overview" :maxlength="800" placeholder="事件描述"></Input>
                    </Form-item>
                    <Form-item label="初步办理意见" prop="complete_opinion">
                        <Input type="textarea" v-model="complete_opinion" :maxlength="800" placeholder="初步办理意见"></Input>
                    </Form-item>
                    <Form-item label="处理结果" prop="solve_result">
                        <Input type="textarea" v-model="solve_result" :maxlength="800" placeholder="处理结果"></Input>
                    </Form-item>
                    <Form-item label="处理结果图片" prop="solve_file">
                        <div v-for="item in showImgLoad" class="reprotImg">
                            <img :src="item" style="width:100%;height:100%;">
                        </div>
                    </Form-item>
                    <Form-item label="回复处理结果" prop="reply_result">
                        <Input type="textarea" v-model="reply_result" :autosize="true" :maxlength="800" placeholder="回复处理结果"></Input>
                    </Form-item>
                    <Form-item label="处理效率评分" v-show="user_type === '1'" prop="score">
                      <Rate disabled v-model="score.speed" />
                    </Form-item>
                    <Form-item label="回复态度评分" v-show="user_type === '1'" prop="score">
                      <Rate disabled v-model="score.attitude" />
                    </Form-item>
                    <Form-item label="综合得分评分" v-show="user_type === '1'" prop="score">
                      <Rate disabled v-model="score.merge" />
                    </Form-item>
                    <Form-item label="群众评价" v-show="user_type === '1'" prop="score">
                      <div>{{score.evaluate}}</div>
                    </Form-item>
                </i-col>
                <i-col span="24">
                    <Table ref="table" :data="jinduData" :columns="jinduColumns" stripe></Table>
                </i-col>
            </Form>

            <div slot="footer">
                <Button type="primary" v-if="printshow" @click="ok">下载表格</Button>
                <Button  @click="cancel">取消</Button>
            </div>
        </Modal>
        <lc :row="saveRow" ref="lc"></lc>
        <pictures ref="pictures"></pictures>
	</i-col>
</template>

<script>
import lc from 'public/lc'
import picture from 'public/picture'
import { ajaxPost } from 'global/axios'
import storage from 'good-storage'
import depSelect from 'public/depSelect.vue'
import { domain, domain2 } from 'global/setting'
export default {
  components: {
    'lc': lc,
    'pictures': picture,
    'dep-select': depSelect
  },
  data () {
    return {
      urlReportNew: '/emergency/report/new',
      complaintList: '/emergency/report/myreport',
      urlJieSu: '/emergency/report/submit_result',
      docList: '/emergency/report/createdoc',
      urlChangeCherf: '/emergency/report/assign',
      urlAddressList: '/sys/department/distinct',
      urlJinDu: '/bus/record/list',
      urlTreeList: '/sys/department/getTree',
      urlCherfList: '/sys/userinfo/findbyrole',
      urlDepList: '/sys/department/list',
      urlAssignCherf: '/emergency/report/assign_chief',
      urlAssignDep: '/emergency/report/assign_down',
      urlAssignUp: '/emergency/report/assign_up',
      uploadUrl: '',
      reply_result: '',
      areaArr: [],
      areaArr1: [],
      comfirmData: [],
      solveData: [],
      completeData: [],
      fallData: [],
      actionPage: '1',
      imgSrc: '',
      topTabs: '',
      chrefTabs: '',
      switch1: false,
      adviceRow: {},
      formItem2: {},
      formItem3: {},
      replay: '',
      modal1: false,
      saveIndex: '',
      savePhotos: [],
      printModal: false,
      printshow: false,
      Page: {
        current: 1,
        pageSize: 13,
        total: 0
      },
      formItem: {},
      formItem1: {},
      address: '',
      phone: '',
      contacts: '',
      river_name: '',
      report_time: '',
      report_no: '',
      confirm_person: '',
      is_secrecy: '',
      contacts_id: '',
      overview: '',
      complete_opinion: '',
      complete_opinion2: '',
      solve_result: '',
      row: {},
      type: '',
      mapModal: false,
      comfirmModal: false,
      comfirm: false,
      solve: false,
      type_solve_is: '',
      comfirm_num: '',
      complete_num: '',
      complaintColumns: [
        {
          title: '地址',
          key: 'address'
        },
        {
          title: '事件来源',
          key: 'user_type',
          width: 120,
          render: (h, param) => {
            if (param.row.user_type == '1') {
              return h('div', {}, '微信投诉')
            } else if (param.row.user_type == '3') {
              return h('div', {}, '电话信访')
            } else if (param.row.user_type == '4') {
              return h('div', {}, '公众app')
            } else if (param.row.user_type == '2') {
              return h('div', {}, '河长巡查')
            } else if (param.row.user_type == '5') {
              return h('div', {}, '省厅下报')
            }
          }
        },
        {
          title: '状态',
          width: 150,
          render: (h, params) => {
            return h(
              'div',
              {
                style: {
                  cursor: 'pointer'
                },
                on: {
                  click: () => {
                    this.saveRow = params.row
                    setTimeout(() => { this.$refs.lc.showModal(params.row) }, 100)
                  }
                }
              },
              params.row.pro_name
            )
          }
        },
        {
          title: '计划时间',
          key: 'plan_time'
        },
        {
          title: '河名',
          key: 'river_name'
        },
        {
          title: '时间',
          key: 'report_time',
          width: 200
        },
        {
          title: '责任河长',
          render: (h, param) => {
            return h('div', {}, param.row.respon_chief.realname)
          }
        },
        {
          title: '责任河长办',
          width: 170,
          render: (h, params) => {
            return h('div', {}, params.row.location.dep_name)
          }
        },
        {
          title: '联系人',
          key: 'contacts'
        },
        {
          title: '电话',
          key: 'phone'
        },
        {
          title: '描述',
          key: 'overview',
          render: (h, param) => {
            var ret = param.row.overview
            ret = ret.substring(0, 10) + '......'
            return h('div', {}, ret)
          }
        },
        {
          title: '图片',
          key: 'photos',
          width: 200,
          render: (h, param) => {
            if (param.row.photos.length > 0) {
              var html = []
              for (let i = 0; i < param.row.photos.length; i++) {
                html.push(
                  h('img', {
                    attrs: {
                      src: domain2 + param.row.photos[i]
                    },
                    style: {
                      width: '50px',
                      height: '50px'
                    },
                    on: {
                      click: () => {
                        this.$refs.pictures.showImg(param.row.photos, i)
                      }
                    }
                  })
                )
              }
              return h('div', html)
            } else {
              return null
            }
          }
        },
        {
          title: '操作',
          key: '',
          width: 360,
          render: (h, param) => {
            let jieguo = h(
              'Button',
              {
                props: {
                  type: 'warning',
                  size: 'small'
                },
                style: {
                  marginRight: '5px'
                },
                on: {
                  click: () => {
                    this.showModal(param.row, '2')
                  }
                }
              },
              '提交处理结果'
            )
            let weizhi = h(
              'Button',
              {
                props: {
                  type: 'primary',
                  size: 'small'
                },
                style: {
                  marginRight: '5px'
                },
                on: {
                  click: () => {
                    this.showMap(param.row)
                  }
                }
              },
              '查看位置'
            )
            let more = h(
              'Button',
              {
                props: {
                  type: 'info',
                  size: 'small'
                },
                style: {
                  marginRight: '5px'
                },
                on: {
                  click: () => {
                    this.print(param.row, '1')
                  }
                }
              },
              '详情'
            )
            let morefile = h(
              'Button',
              {
                props: {
                  type: 'info',
                  size: 'small'
                },
                style: {
                  marginRight: '5px'
                },
                on: {
                  click: () => {
                    this.print(param.row, '1')
                  }
                }
              },
              '详情'
            )
            if (param.row.solve_is === '处理中') {
              if (param.row.pro_num == 'A2' || param.row.pro_num == 'B2' || param.row.pro_num == 'AX2' || param.row.pro_num == 'BX2') {
                return h('div', [weizhi, jieguo, more])
              } else {
                return h('div', [weizhi, more])
              }
            } else {
              return h('div', [weizhi, morefile])
            }
          }
        }
      ],
      jinduData: [],
      jinduColumns: [
        {
          title: '过程',
          key: 'overview'
        },
        {
          title: '时间',
          key: 'date_time'
        }
      ],
      uploadList: [],
      solve_result2: '',
      showImgLoad: [],
      username: '',
      dep_name: '',
      userList: [],
      depList: [],
      saveRow: {},
      searchItem: {
        river_name: '',
        chref_name: '',
        report_time: [],
        deps: [],
        report_no: '',
        overday: '',
        is_multiple: false,
        can_use: true
      },
      advice: '',
      lcUrl: '',
      lcModal: '',
      score: {},
      user_type: ''
    }
  },
  methods: {
    logout () {
      if (storage.session.get('isOtherLoginType') === true) {
        let { origin } = window.location
        let backurl = `${origin}/hzSystem/logout`
        window.location.href = `
        https://xtbg.gdzwfw.gov.cn/zwrz/rz/sso/logout?client_id=zwrz_fshzzgl&backurl=${encodeURIComponent(backurl)}
        `
      }
      storage.remove('token')
      storage.remove('realname')
      storage.remove('roles')
      storage.remove('userid')
      storage.remove('username')
      storage.remove('position')
      storage.remove('head')
      storage.remove('level')
      storage.remove('dep_name')
      this.$router.push('/login')
    },
    getDep () {
      var params = {
        data: {},
        url: this.urlTreeList,
        token: storage.session.get('token'),
        success: res => {
          this.areaArr1 = res.data.result
        }
      }
      ajaxPost(params)
    },
    aa (name) {
      this.getComplaint('1', name)
    },
    sendAdvice () {
      var that = this
      this.adviceRow.overseer.replay = this.replay
      this.adviceRow.overseer.replay_realname = storage.session.get('realname')
      this.adviceRow.overseer.replay_username = storage.session.get('username')
      this.adviceRow.overseer.replay_time = new Date().format(
        'yyyy-MM-dd hh:mm:ss'
      )
      var params = {
        data: this.adviceRow,
        url: this.sendComplaint,
        token: storage.session.get('token'),
        success: res => {
          if (res.data.code == '0000') {
            that.$Message.success({
              content: res.data.message
            })
            if (that.actionPage === '') {
              that.getComplaint('1', that.type_solve_is)
              that.addBadge()
            } else {
              that.getComplaint(that.actionPage, that.type_solve_is)
              that.addBadge()
            }
            that.complete_opinion2 = ''
          } else {
            that.$Message.warning({
              title: res.data.message
            })
          }
        }
      }
      ajaxPost(params)
    },
    showMap (row) {
      this.mapModal = true
      var center = new qq.maps.LatLng(row.lat, row.lng)
      var center2 = new qq.maps.LatLng(row.con_lat, row.con_lng)
      var map = new qq.maps.Map(document.getElementById('map'), {
        center: center,
        zoom: 16,
        disableDoubleClickZoom: false
      })
      var marker = new qq.maps.Marker({
        position: center,
        map: map
      })
      var marker2 = new qq.maps.Marker({
        position: center2,
        map: map
      })
      var anchor = new qq.maps.Point(0, 39),
        size = new qq.maps.Size(42, 68),
        origin = new qq.maps.Point(0, 0),
        markerIcon = new qq.maps.MarkerImage(
          '/static/img/gis1.png',
          size,
          origin,
          anchor
        )
      var anchor2 = new qq.maps.Point(0, 39),
        size2 = new qq.maps.Size(42, 68),
        origin2 = new qq.maps.Point(0, 0),
        markerIcon2 = new qq.maps.MarkerImage(
          '/static/img/weizhi.png',
          size2,
          origin2,
          anchor2
        )
      marker2.setIcon(markerIcon)
      marker.setIcon(markerIcon2)
    },
    getComplaint: function (page = 1, type) {
      var that = this
      var params = {}
      params.data = {}
      params.data.page = page
      params.data.pageSize = this.Page.pageSize
      params.data.order = { report_time: -1 }
      params.data.chooise = 'function'
      params.data.searchValue = {
        river_name: '测试河|#|ne',
        solve_is: '待处理,审核中|#|in'
      }
      if (type !== undefined) {
        params.data.searchValue.solve_is = type
        this.type_solve_is = type
      }
      if (this.searchItem.river_name !== '') {
        params.data.searchValue.river_name =
          this.searchItem.river_name + '|#|like'
      }
      if (this.searchItem.chref_name !== '') {
        params.data.searchValue['respon_chief.realname'] =
          this.searchItem.chref_name + '|#|like'
      }
      if (this.searchItem.report_time.length != 0) {
        params.data.searchValue.report_time =
          this.searchItem.report_time[0] +
          ' 00:00:00|#|' +
          this.searchItem.report_time[1] +
          ' 23:59:59'
      }
      if (this.searchItem.deps.length != 0) {
        params.data.searchValue['location.dep_name'] =
          this.searchItem.deps + '|#|like'
      }
      if (this.searchItem.report_no !== '') {
        params.data.searchValue.report_no =
          this.searchItem.report_no + '|#|like'
      }
      if (this.searchItem.user_type !== '') {
        params.data.searchValue.user_type = this.searchItem.user_type
      }
      if (this.searchItem.overday !== '') {
        params.data.searchValue.over_day = parseInt(this.searchItem.overday)
      }
      if (this.searchItem.is_multiple === true) {
        params.data.searchValue.is_multiple = '1'
      }
      if (type !== '已处理') {
        if (this.searchItem.can_use === true) {
          params.data.addparam = true
        }
      }
      params.token = storage.session.get('token')
      params.url = this.complaintList
      params.success = function (res) {
        that.$Loading.finish()
        if (type == '待受理') {
          that.comfirmData = res.data.result.result
          that.comfirm_num = res.data.result.totalSize
        } else if (type == '已处理') {
          that.completeData = res.data.result.result
        } else if (type == '处理中') {
          that.solveData = res.data.result.result
          that.complete_num = res.data.result.totalSize
        }
        that.Page.total = res.data.result.totalSize
        that.addBadge()
      }
      ajaxPost(params)
    },
    changePage: function (page) {
      this.getComplaint(page, this.type_solve_is)
      this.actionPage = page
    },
    send: function () {
      var that = this
      var params = {}
      params.data = {}
      params.data._id = this.row._id
      if (this.type === '2') {
        params.data.solve_file = []
        params.data.solve_result = this.solve_result2
        this.uploadList.map(item => {
          params.data.solve_file.push(item.url)
        })
        params.url = this.urlJieSu
      }
      params.token = storage.session.get('token')
      params.success = res => {
        if (res.data.code == '0000') {
          this.$Message.info({
            content: res.data.message
          })
          this.getComplaint(this.actionPage, this.type_solve_is)
          that.solve_result2 = ''
        } else {
          this.$Notice.open({
            desc: res.data.message
          })
        }
      }
      ajaxPost(params)
    },
    showImage: function (photos, i) {
      this.saveIndex = i
      this.savePhotos = photos
      this.modal1 = true
      this.imgSrc = domain2 + photos[i]
    },
    print (row, type) {
      if (type == '1') {
        this.printshow = true
      } else {
        this.printshow = false
      }
      if (row.solve_file) {
        this.showImgLoad = row.solve_file
        this.reply_result = row.reply_result
      } else {
        this.showImgLoad = []
        this.reply_result = ''
      }
      if (row.score) {
        this.score = row.score
      } else {
        this.score = {
          speed: 0,
          attitude: 0,
          merge: 0,
          evaluate: ''
        }
      }
      this.user_type = row.user_type
      this.jinduData = row.records
      this.printModal = true
      this.address = row.address
      this.phone = row.phone
      this.contacts = row.contacts
      this.river_name = row.river_name
      this.report_time = row.report_time
      this.report_no = row.report_no
      this.confirm_person = '河长办'
      this.is_secrecy = row.is_secrecy
      this.contacts_id = row.contacts_id
      this.overview = row.overview
      this.complete_opinion = row.complete_opinion
      this.solve_result = row.solve_result
      if (row.overseer !== undefined) {
        this.advice = row.overseer.advice
      } else {
        this.advice = ''
      }
    },
    cancel () {
      this.printModal = false
    },
    ok () {
      var that = this
      var params = {}
      params.data = {
        address: this.address,
        phone: this.phone,
        contacts: this.contacts,
        river_name: this.river_name,
        report_time: this.report_time,
        report_no: this.report_no,
        confirm_person: this.confirm_person,
        overview: this.overview,
        complete_opinion: this.complete_opinion,
        contacts_id: this.contacts_id
      }
      params.url = this.docList
      params.token = storage.session.get('token')
      params.success = function (res) {
        that.$Message.success({
          content: res.data.message
        })
        window.open(domain2 + res.data.result)
      }
      ajaxPost(params)
    },
    showModal (row, type) {
      this.row = row
      this.type = type
      this.solve_result2 = ''
      this.complete_opinion2 = ''
      this.comfirmModal = true
      if (type == '1') {
        this.comfirm = true
        this.solve = false
      }
      if (type == '3') {
        this.comfirm = true
        this.solve = false
      }
      if (type == '2') {
        this.comfirm = false
        this.solve = true
        this.uploadUrl =
          domain + '/filemanage/uploadphoto?dir=reportPhoto/solveFile/' +
          row.report_no +
          '&token=' +
          storage.session.get('token')
        setTimeout(() => {
          this.uploadList = this.$refs.upload.fileList
          if (this.uploadList.length > 0) {
            this.$refs.upload.clearFiles()
            this.uploadList = this.$refs.upload.fileList
          }
        }, 200)
      }
    },
    addBadge () {
      var that = this
      $('.ivu-tabs-tab:eq(0)').html('处理中')
      if (that.complete_num == '') {
        $('.ivu-tabs-tab:eq(0)').append("<sup class='ivu-badge-count'>0</sup>")
      } else {
        $('.ivu-tabs-tab:eq(0)').append(
          "<sup class='ivu-badge-count'>" + that.complete_num + '</sup>'
        )
      }
    },
    getAddress () {
      var that = this
      var params = {
        data: {
          searchValue: {},
          fieldName: 'dep_name',
          type: 'String'
        },
        token: storage.session.get('token'),
        url: this.urlAddressList,
        success: res => {
          console.log(res)
          this.areaArr = res.data.result
        }
      }
      if (storage.session.get('level') == '2') {
        params.data.searchValue.level2 = storage.session.get('dep_name')
        params.data.searchValue.level = 3
      }
      ajaxPost(params)
    },
    handleRemove (file) {
      const fileList = this.$refs.upload.fileList
      this.$refs.upload.fileList.splice(fileList.indexOf(file), 1)
    },
    handleSuccess (res, file) {
      file.url = res.result.path
      file.name = res.result.filename
    },
    handleFormatError (file) {
      this.$Notice.warning({
        title: '文件格式不正确',
        desc:
          '文件格式不正确，请上传 jpg 或 png 格式的图片。'
      })
    },
    handleMaxSize (file) {
      this.$Notice.warning({
        title: '超出文件大小限制',
        desc: '文件太大，不能超过 20M。'
      })
    },
    handleBeforeUpload () {
      const check = this.$refs.upload.fileList.length < 7
      if (!check) {
        this.$Notice.warning({
          title: '最多只能上传 7 张图片。'
        })
      }
      return check
    },
    change (data) {
      if (data[0] === '') {
        this.searchItem.report_time = []
        return
      }
      this.searchItem.report_time = data
    },
    rowClassName: function (row) {
      let today = new Date().format('yyyy-MM-dd')
      if (today > row.plan_time) {
        return 'bg-red'
      }
      if (row.is_multiple == '1') {
        return 'bg-orange'
      }
    },
    getDepData (data) {
      if (data === undefined) {
        this.searchItem.deps = ''
      } else {
        this.searchItem.deps = data
      }
    }
  },
  mounted: function () {
    this.getComplaint('1', '处理中')
    this.getAddress()
    this.getDep()
    this.addBadge()
  },
  watch: {
    'searchItem.is_multiple': function (data) {
      this.getComplaint('1', this.type_solve_is)
    }
  }
}
</script>
